package cn.qf.dao.impl;

import cn.qf.dao.AdminDao;
import cn.qf.pojo.Admin;
import cn.qf.utils.DruidJbdcUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import javax.management.Query;
import java.sql.SQLException;

public class AdminDaoImpl implements AdminDao {
    @Override
    public Admin selectAdminById(String name) throws SQLException {
        //query是一个查询参数类，封装了查询条件分页排序等，query runner用来实现表数据的增删改的操作
        //创建query runner类对象
        QueryRunner queryRunner = new QueryRunner(DruidJbdcUtils.getDataSource());
        //查询数据的sql语句
        String sql="select * from admin where adminname=?";
        //查询
        Admin admin=queryRunner.query(sql,new BeanHandler<Admin>(Admin.class),name);
        return null;
    }
}
